package cn.china.xfood.service;



import com.github.pagehelper.PageHelper;
import entity.Product;
import mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Properties;

@Service
public class MainService implements ProductMapper {

    @Autowired
    ProductMapper productMapper;


    @Override
    public int deleteByPrimaryKey(Integer id) {
        return productMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Product record) {
        return productMapper.insert(record);
    }

    @Override
    public int insertSelective(Product record) {
        return productMapper.insertSelective(record);
    }

    @Override
    public Product selectByPrimaryKey(Integer id) {
        return productMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Product record) {
        return productMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Product record) {
        return productMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<String> selectAllType() {
        return productMapper.selectAllType();
    }

    @Override
    public List<Product> selectAllPro() {
        return productMapper.selectAllPro();
    }

//    @Override
//    public List<Product> selectByType(String type, int pageNum, int pageCount) {
//        PageHelper.startPage(pageNum,pageCount);
//        return productMapper.selectByType(type);
//    }

    @Override
    public List<Product> selectByType(String type, int pageNum, int pageCount) {

        return productMapper.selectByType(type,pageNum,pageCount);
    }

    @Override
    public List<Product> selectAllProduct(int pageNum, int pageCount) {
        return productMapper.selectAllProduct(pageNum,pageCount);
    }

    @Override
    public int selectCountByTypename(String type) {
        return productMapper.selectCountByTypename(type);
    }


}
